package org.sdp.pearproject.controller;


import org.sdp.pearproject.controller.custom.*;
import org.sdp.pearproject.dto.request.*;
import org.sdp.pearproject.dto.response.*;

import java.util.List;

import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @ClassName: TaskStagesTemplateController
 * @Description:
 * @Author: SDP
 * @Date: 2022-07-21
 * @Version: 1.0
 * Table: pear_task_stages_template
 * Comment:
 * 任务列表模板表
 */
@RestController
@RequestMapping(value = "/task_stages_template")
public class TaskStagesTemplateController extends TaskStagesTemplateCustomController {
    static {
        addRequestClass("task_stages_template", "add", "taskStagesTemplateController", TaskStagesTemplateController.class, TaskStagesTemplateAddRequest.class);
        addRequestClass("task_stages_template", "add_encrypt", "taskStagesTemplateController", TaskStagesTemplateController.class, TaskStagesTemplateAddRequest.class);

        addRequestClass("task_stages_template", "update", "taskStagesTemplateController", TaskStagesTemplateController.class, TaskStagesTemplateUpdateRequest.class);
        addRequestClass("task_stages_template", "update_encrypt", "taskStagesTemplateController", TaskStagesTemplateController.class, TaskStagesTemplateUpdateRequest.class);

        addRequestClass("task_stages_template", "delete", "taskStagesTemplateController", TaskStagesTemplateController.class, TaskStagesTemplateDeleteRequest.class);
        addRequestClass("task_stages_template", "delete_encrypt", "taskStagesTemplateController", TaskStagesTemplateController.class, TaskStagesTemplateDeleteRequest.class);

        addRequestClass("task_stages_template", "query", "taskStagesTemplateController", TaskStagesTemplateController.class, TaskStagesTemplateQueryRequest.class);
        addRequestClass("task_stages_template", "query_encrypt", "taskStagesTemplateController", TaskStagesTemplateController.class, TaskStagesTemplateQueryRequest.class);

        addRequestClass("task_stages_template", "list", "taskStagesTemplateController", TaskStagesTemplateController.class, TaskStagesTemplateQueryRequest.class);
        addRequestClass("task_stages_template", "list_encrypt", "taskStagesTemplateController", TaskStagesTemplateController.class, TaskStagesTemplateQueryRequest.class);

        addRequestClass("task_stages_template", "count", "taskStagesTemplateController", TaskStagesTemplateController.class, TaskStagesTemplateQueryRequest.class);
        addRequestClass("task_stages_template", "count_encrypt", "taskStagesTemplateController", TaskStagesTemplateController.class, TaskStagesTemplateQueryRequest.class);

        addRequestClass("task_stages_template", "stat", "taskStagesTemplateController", TaskStagesTemplateController.class, TaskStagesTemplateQueryRequest.class);
        addRequestClass("task_stages_template", "stat_encrypt", "taskStagesTemplateController", TaskStagesTemplateController.class, TaskStagesTemplateQueryRequest.class);

    }

    @PostMapping("/add")
    public Integer addTaskStagesTemplate(@MixRequestBody TaskStagesTemplateAddRequest request, Integer callFromEncrypt) throws Exception {
        super.fixRequest("task_stages_template", "add", request, callFromEncrypt);
        return super.addTaskStagesTemplate(request);
    }

    @PostMapping("/add_encrypt")
    public String addTaskStagesTemplateEncrypt(@MixRequestBody String strRequest) throws Exception {
        TaskStagesTemplateAddRequest request = (TaskStagesTemplateAddRequest) super.decrypt("task_stages_template", "add_encrypt", strRequest, TaskStagesTemplateAddRequest.class);
        Integer result = addTaskStagesTemplate(request, 1);
        if (result == null) {
            return null;
        }
        String response = toJSONString(result);

        return super.encrypt(request, response);
    }

    @PostMapping("/update")
    public Integer updateTaskStagesTemplate(@MixRequestBody TaskStagesTemplateUpdateRequest request, Integer callFromEncrypt) throws Exception {
        super.fixRequest("task_stages_template", "update", request, callFromEncrypt);
        return super.updateTaskStagesTemplate(request);
    }

    @PostMapping("/update_encrypt")
    public String updateTaskStagesTemplateEncrypt(@MixRequestBody String strRequest) throws Exception {
        TaskStagesTemplateUpdateRequest request = (TaskStagesTemplateUpdateRequest) super.decrypt("task_stages_template", "update_encrypt", strRequest, TaskStagesTemplateUpdateRequest.class);
        Integer result = updateTaskStagesTemplate(request, 1);
        if (result == null) {
            return null;
        }
        String response = toJSONString(result);

        return super.encrypt(request, response);
    }

    @PostMapping("/delete")
    public Integer deleteTaskStagesTemplate(@MixRequestBody TaskStagesTemplateDeleteRequest request, Integer callFromEncrypt) throws Exception {
        super.fixRequest("task_stages_template", "delete", request, callFromEncrypt);
        return super.deleteTaskStagesTemplate(request);
    }

    @PostMapping("/delete_encrypt")
    public String deleteTaskStagesTemplateEncrypt(@MixRequestBody String strRequest) throws Exception {
        TaskStagesTemplateDeleteRequest request = (TaskStagesTemplateDeleteRequest) super.decrypt("task_stages_template", "delete_encrypt", strRequest, TaskStagesTemplateDeleteRequest.class);
        Integer result = deleteTaskStagesTemplate(request, 1);
        if (result == null) {
            return null;
        }
        String response = toJSONString(result);

        return super.encrypt(request, response);
    }

    @PostMapping("/query")
    public TaskStagesTemplateQueryResponse queryTaskStagesTemplate(@MixRequestBody TaskStagesTemplateQueryRequest request, Integer callFromEncrypt) throws Exception {
      super.fixRequest("task_stages_template", "query", request, callFromEncrypt);
      return super.queryTaskStagesTemplate(request);
    }

    @PostMapping("/query_encrypt")
    public String queryTaskStagesTemplateEncrypt(@MixRequestBody String strRequest) throws Exception {
        TaskStagesTemplateQueryRequest request = (TaskStagesTemplateQueryRequest) super.decrypt("task_stages_template", "query_encrypt", strRequest, TaskStagesTemplateQueryRequest.class);
        TaskStagesTemplateQueryResponse result = queryTaskStagesTemplate(request, 1);
        if (result == null) {
            return null;
        }
        String response = toJSONString(result);

        return super.encrypt(request, response);
    }

    @PostMapping("/list")
    public List<TaskStagesTemplateQueryResponse> listTaskStagesTemplate(@MixRequestBody TaskStagesTemplateQueryRequest request, Integer callFromEncrypt) throws Exception {
        super.fixRequest("task_stages_template", "list", request, callFromEncrypt);
        if (super.needTotal("task_stages_template", "list", request)) {
            super.setTotal("task_stages_template", "list", request, super.countTaskStagesTemplate(request));
        }
        return super.listTaskStagesTemplate(request);
    }

    @PostMapping("/list_encrypt")
    public String listTaskStagesTemplateEncrypt(@MixRequestBody String strRequest) throws Exception {
        TaskStagesTemplateQueryRequest request = (TaskStagesTemplateQueryRequest) super.decrypt("task_stages_template", "list_encrypt", strRequest, TaskStagesTemplateQueryRequest.class);
        List<TaskStagesTemplateQueryResponse> result = listTaskStagesTemplate(request, 1);
        if (result == null) {
            return null;
        }
        String response = toJSONString(result);

        return super.encrypt(request, response);
    }

    @PostMapping("/count")
    public Integer countTaskStagesTemplate(@MixRequestBody TaskStagesTemplateQueryRequest request, Integer callFromEncrypt) throws Exception {
      super.fixRequest("task_stages_template", "count", request, callFromEncrypt);
      return super.countTaskStagesTemplate(request);
    }


    @PostMapping("/count_encrypt")
    public String countTaskStagesTemplateEncrypt(@MixRequestBody String strRequest) throws Exception {
        TaskStagesTemplateQueryRequest request = (TaskStagesTemplateQueryRequest) super.decrypt("task_stages_template", "count_encrypt", strRequest, TaskStagesTemplateQueryRequest.class);
        Integer result = countTaskStagesTemplate(request, 1);
        if (result == null) {
            return null;
        }
        String response = toJSONString(result);

        return super.encrypt(request, response);
    }

    @PostMapping("/stat")
    public BaseStatResponse statTaskStagesTemplate(@MixRequestBody TaskStagesTemplateQueryRequest request, Integer callFromEncrypt) throws Exception {
        super.fixRequest("task_stages_template", "stat", request, callFromEncrypt);
        return super.statTaskStagesTemplate(request);
    }

    @PostMapping("/stat_encrypt")
    public String statTaskStagesTemplateEncrypt(@MixRequestBody String strRequest) throws Exception {
        TaskStagesTemplateQueryRequest request = (TaskStagesTemplateQueryRequest) super.decrypt("task_stages_template", "stat_encrypt", strRequest, TaskStagesTemplateQueryRequest.class);
        BaseStatResponse result = statTaskStagesTemplate(request, 1);
        if (result == null) {
            return null;
        }
        String response = toJSONString(result);

        return super.encrypt(request, response);
    }


}
